/**
 * Copyright [2019] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.inject.container;

import com.hyts.inject.Injector;
import lombok.Getter;
import lombok.Setter;

import java.lang.annotation.Annotation;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @project-name:coffice-toolbox
 * @package-name:com.hyts.inject.container
 * @author:LiBo/Alex
 * @create-date:2020-04-10 16:36
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description:
 */
public class BeanContainer {

    /**
     * 已经生成的单例实例放在这里，后续注入处可以直接拿
     */
    @Getter
    @Setter
    private Map<Class<?>, Object> singletons = new ConcurrentHashMap<Class<?>, Object>(){{put(Injector.class, this);}};

    /**
     *  尚未初始化的单例类放在这里
     */
    @Getter
    @Setter
    private Map<Class<?>, Class<?>> singletonClasses = new ConcurrentHashMap<>();

    /**
     * 已经生成的限定器实例放在这里，可续注入处可以直接拿
     * 限定器就是在单例基础上增加一个类别，相当于多种单例，用Annotation来限定具体哪个单例
     */
    @Getter
    @Setter
    private Map<Class<?>, Map<Annotation, Object>> qualifieds = new ConcurrentHashMap<>();

    /**
     * 尚未初始化的限定类别单例类放在这里
     */
    @Getter
    @Setter
    private Map<Class<?>, Map<Annotation, Class<?>>> qualifiedClasses = new ConcurrentHashMap<>();

    /**
     * 准备进行构造的类
     */
    @Getter
    @Setter
    private Set<Class<?>> readyClasses = Collections.synchronizedSet(new HashSet<>());

    /**
     * 准备进行构造的类
     */
    @Getter
    @Setter
    private Map<Class<?>,Object> readyClassesObject = new ConcurrentHashMap<>();

}
